home *** CD-ROM | disk | FTP | other *** search
- function initLevelPara(para)
- {
- setGameLevelStart = true;
- tgt_type = para.tgt_type;
- tgt_totalNum = para.tgt_totalNum;
- tgt_speed = para.tgt_speed;
- min_speed = para.min_speed;
- speed_a = para.speed_a;
- speed_a = 4;
- type_num_array = new Array();
- i = 1;
- while(i <= tgt_type)
- {
- type_num_array[i] = 0;
- i++;
- }
- tgt_same_base = para.tgt_same_base;
- tgt_same_change = para.tgt_same_change;
- tgt_same_total = tgt_same_base + random(tgt_same_change);
- tgt_same_num = 0;
- tagTime = para.tagTime;
- superBall_rnd = para.superBall_rnd;
- shooting = false;
- levelTimes = 0;
- }
- function show_para(_para)
- {
- trace("para=new Object()");
- for(name in _para)
- {
- trace("para." + name + "=" + _para[name]);
- }
- }
- function show_centerPos(pos)
- {
- trace("pos=new Object()");
- trace("pos.x=" + pos.x);
- trace("pos.y=" + pos.y);
- }
- function traceRoad(road)
- {
- trace("//------------");
- show_pos(road.road);
- show_para(road.para);
- show_centerPos(road.center_pos);
- trace("//------------");
- }
- function initMovie()
- {
- for(var _loc2_ in tgt_mcs)
- {
- trace(" tgt_mas[it] = " + tgt_mas[_loc2_]);
- }
- trace("---------------init Movie--------------");
- clearAll();
- trace(" ------ 产生目球和目标球 -----");
- center_mc.nextBall._visible = true;
- center_mc.nextBall.type = random(tgt_type) + 1;
- center_mc.nextBall.gotoAndStop(center_mc.nextBall.type);
- center_mc.nextBall2._visible = true;
- center_mc.nextBall2.type = random(tgt_type) + 1;
- center_mc.nextBall2.gotoAndStop(center_mc.nextBall2.type);
- trace(center_mc.nextBall2.type + "^^^^^^^^^^^^^^^^^^^^^^^££££££££" + center_mc.nextBall.type);
- crtNewBall();
- snd_move_in_start();
- crt_new_ball();
- last_ball = firstBall;
- move_listener_mc.onEnterFrame = function()
- {
- if(!game_pause)
- {
- if(Key.isDown(32) and !KEYtemp)
- {
- if(_root.beijingGK.hitTest(_root.beijingGK._xmouse,_root.beijingGK._ymouse,false))
- {
- trace("change Ball");
- _root.cheangballHS();
- KEYtemp = true;
- }
- }
- else if(!Key.isDown(32) and KEYtemp)
- {
- KEYtemp = false;
- }
- tgt_forward();
- }
- };
- }
- function setPara_default()
- {
- trace(" ------ setPara_default -----");
- firstBall = undefined;
- last_ball = undefined;
- gameOver = false;
- m_lock = false;
- boom_bool = false;
- forward_bool = true;
- forward_num = 0;
- dir_bool = false;
- dir_num = 0;
- dir_num_total = 500;
- boom_bool = false;
- boom_lock_times = 0;
- tgt_num = 0;
- tgt_depth = 100;
- b_depth = 1000;
- balls_num = 0;
- remove_arr_array = new Array();
- break_array = new Array();
- remove_num = 0;
- last_pos = 0;
- i = 0;
- while(i < xNum)
- {
- area[i] = new Array();
- j = 0;
- while(j < yNum)
- {
- area[i][j] = new Object();
- area[i][j].tgt_ball = new Array();
- j++;
- }
- i++;
- }
- myGrid = new Grid(grid_width,xNum,yNum,area);
- }
- function initShoot()
- {
- center_mc._x = center_bg._x;
- center_mc._y = center_bg._y;
- center_bg.move_btn._visible = false;
- shoot_btn.useHandCursor = false;
- center_mc.onMouseMove = function()
- {
- if(!game_pause)
- {
- center_rotation();
- updateAfterEvent();
- }
- };
- shoot_btn.onPress = function()
- {
- if(!game_pause)
- {
- if(ball != undefined)
- {
- maxcomboTE = 0;
- ballShoot();
- }
- else if(_root._currentframe > 15 and _root.gameOver == false)
- {
- trace("crtNewBall");
- crtNewBall();
- }
- }
- };
- }
- function clearAll()
- {
- trace(" ----------clear All---------");
- clearBall();
- clearTgtBall();
- }
- function clearBall()
- {
- delete now_type_tmp_arr;
- delete shoot_listener_mc.onEnterFrame;
- ball.holder.removeMovieClip();
- delete ball;
- }
- function clearDraw()
- {
- line.clear();
- line2.clear();
- dir_mc.clear();
- }
- function show_mainMc(bool)
- {
- if(bool)
- {
- center_mc._x = center_bg._x;
- center_mc._y = center_bg._y;
- center_bg.move_btn._visible = false;
- }
- center_mc._visible = bool;
- center_bg._visible = bool;
- mouth_start._visible = bool;
- mouth._visible = bool;
- }
- function saveToLocal()
- {
- trace("保存到本地");
- if(pos_array.length > 1)
- {
- if(road_name != "")
- {
- board_save.road_name = road_name;
- }
- else
- {
- board_save.road_name = "user_" + random(65535);
- }
- closeAllBoard();
- openBoard(board_save);
- Selection.setFocus(board_save.roadName);
- trace("saveToLocal " + board_save);
- }
- }
- function openBoard(board)
- {
- board.swapDepths(100);
- center_bg.move_btn._visible = false;
- road_btn.enabled = false;
- board._visible = true;
- }
- function closeBoard(board)
- {
- topMenu.swapDepths(topMenu.init_depth);
- center_bg.move_btn._visible = true;
- road_btn.enabled = true;
- board._visible = false;
- board._x = board.initx;
- board._y = board.inity;
- board.myicon.gotoAndStop(1);
- }
- function closeAllBoard()
- {
- closeBoard(board_save);
- closeBoard(board_open);
- closeBoard(board_setup);
- }
- function levelRun(levleTitle, level_num, bg_snd)
- {
- trace(" meiliyou ");
- for(var _loc2_ in _root.tgt_mcs)
- {
- trace(" tgt_mcs -------- = " + tgt_mcs[_loc2_]);
- }
- old_levelNum = levelNum;
- levelNum = level_num;
- setLevel(levleTitle);
- goal_total_mc.getNum(goal_total,goal_total_mc.obj,"mynum",12);
- life_mc.getNum(life,life_mc.obj,"mynum",12);
- setTgt_bar();
- center_bg._x = pos.x;
- center_bg._y = pos.y;
- pos_array = new Array();
- pos_array = set_pos(x_array,y_array,r_array);
- setPara_default();
- initLevelPara(para);
- readyPlay();
- show_mainMc(true);
- m_lock = false;
- rndPlay_bg_snd();
- }
- function openWin(win)
- {
- win.swapDepths(100);
- win._visible = true;
- noclick_btn._visible = true;
- }
- function closeWin(win)
- {
- trace("closeWin " + win);
- win._visible = false;
- win._x = win.initx;
- win._y = win.inity;
- win.myicon.gotoAndStop(1);
- noclick_btn._visible = false;
- }
- var KEYtemp = false;
- clearLine = function()
- {
- line.cacheAsBitmap = false;
- line1.cacheAsBitmap = false;
- line2.cacheAsBitmap = false;
- line.clear();
- line2.clear();
- crtLine = false;
- };
- clearTgtBall = function()
- {
- delete move_listener_mc.onEnterFrame;
- for(name in tgt_mcs)
- {
- if(name != _root.EndBall._name)
- {
- if(typeof tgt_mcs[name] == "movieclip")
- {
- tgt_mcs[name].removeMovieClip();
- }
- }
- }
- };
- setFlower = function()
- {
- for(name in tgt_mcs)
- {
- if(typeof tgt_mcs[name] == "movieclip")
- {
- tgt_mcs[name].flower.roll_mc._visible = flower_show_bool;
- tgt_mcs[name].colors = new Color(tgt_mcs[name].flower.roll_mc);
- tgt_mcs[name].colors.setRGB(flower_array[tgt_mcs[name].type - 1]);
- }
- }
- };
-